<template>
  <view class="content">
    <view class="text-area">
      <text>首页</text>
      <navigator url="/pages/movie/movie" open-type="navigate">跳转详情</navigator>
      <button @click="goMovie">跳转详情</button>
    </view>
    <view>count: {{ countStore.count }}</view>
    <button @click="countStore.changeCount(2)">加2</button>
    <view class="banner">
      <swiper :autoplay="true">
        <swiper-item v-for="item in banners" :key="item.pic">
          <image :src="item.pic"></image>
        </swiper-item>
      </swiper>
    </view>
  </view>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import { useCountState } from '@/store/counter'
const countStore = useCountState()
const title = ref('Hello')
const goMovie = () => {
  uni.navigateTo({
    url: '/pages/movie/movie'
  })
}
const banners = ref([])
uni.request({
    url: 'https://zyxcl.xyz/music/api/banner', //仅为示例，并非真实接口地址。
    success: (res) => {
        console.log(res.data);
        banners.value = res.data.banner
    }
});
</script>

<style lang="scss">
body{
  color: $uni-color-primary;
}
.content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

</style>
